$(document).ready(function() {
    cert_train = new CertTrain('#certstrains');
    cert_train.drawElems(certs_trains);

    $('div.tools').on('click', 'i.fa-list', function(e) {
        e.preventDefault();
        var url = $(this).parent().attr('href');
        $.get(url, {}, function(code) {
            var wnd = $("<div></div>");
            wnd.html(code);
            wnd = wnd.kendoWindow({
                width: "1155px",
                title: "Pasaporte",
                actions: [
                    "Close"
                ]
            }).data("kendoWindow").open().center();
            wnd.bind("deactivate", function () {
                wnd.destroy();
            });
        });
    });
});

function CertTrain(container)
{
    this.container = $(container); // container 
    this.selectorTemplate = '.certstrainsTemplate';
    this.template = kendo.template(this.container.find(this.selectorTemplate).html());
    this.drawElems = function(elems)
    {
        var context = this;
        elems.forEach(function(elem) {
            var profileHtml = context.template(elem);
            context.container.append(profileHtml);
        });
    };
}